<template>
  <div class="home">
    <img alt="Vue logo" src="../assets/logo.png">
    <HelloWorld msg="Welcome to Your Vue.js App"/>
    <my-btn title="提交按钮"/>
    <button @click.once="sign">{{text}}</button>
  </div>
</template>

<script>
// @ is an alias to /src
import HelloWorld from '@/components/HelloWorld.vue'

export default {
  name: 'Home',
  data(){
    return {
      text:'打卡',
    }
  },
  components: {
    HelloWorld
  },
  mounted(){
    this.text=sessionStorage.getItem('sign')?'已打卡':'打卡';
  },
  methods:{
    sign(){
      this.text='已打卡';
      sessionStorage.setItem('sign',true);
    }
  }
}
</script>
